package com.kotlin.lib

sealed class PayType {
    object Purchase : PayType()
    object Subscribe : PayType()
}

fun deal(payType: PayType) {
    when (payType) {
        is PayType.Purchase -> println("purchase")
        is PayType.Subscribe -> println("subscribe")
    }
}


sealed class Operation {
    class Add(val value: Int) : Operation()

    class Substract(val value: Int) : Operation()

    class Multiply(val value: Int) : Operation()

    class Divide(var value: Int) : Operation()
}

fun deal(x: Int, op: Operation) {
    when (op) {
        is Operation.Add -> x + op.value
        is Operation.Substract -> x - op.value
        is Operation.Multiply -> x * op.value
        is Operation.Divide -> x / op.value
    }
}

fun main() {


}